--------------------------------------------------------------------------------
      name:  <unnamed>
       log:  /Volumes/rdss_meghrogers/Current Research/Markets-Pridemore/Work/MA
> R02-SampDiag-UNODC.log
  log type:  text
 opened on:   5 May 2025, 14:04:44

. 
. //  program:    Stata 
. //  task:       Sample and diagnostics 
. //  project:    Markets  
. 
. version
version 18.5

. clear all

. macro drop _all

. set linesize 80

. set more off

. local tag " 05-05-25"

. local file "MAR02-SampDiag-UNODC"

. local note "|`tag' | `file'"

. local opt "noparen sideway excel noaster  bdec(2)  sdec(2)  pdec(3)   adec(2) 
> e(r2) stats(coef se pval)"

. local dv "lrhom_un"

. local iv "fraser"

. local cont "infantmort  edu unemp  popdense perurban  sexratio"

. local cont2 "infantmort  gini edu unemp  popdense perurban  sexratio"

. 
. //      #0
. //      loading data 
. use MAR01-DataClean-UNODC, clear 

. 
. //      #1
. //      getting sample 
. gen lrhom_un=log(rhom_un)
(18,664 missing values generated)

. xtset CID year 

Panel variable: CID (unbalanced)
 Time variable: year, 2 to 2023, but with gaps
         Delta: 1 unit

. xtreg `dv' `iv' `cont', fe 

Fixed-effects (within) regression               Number of obs     =      1,993
Group variable: CID                             Number of groups  =        140

R-squared:                                      Obs per group:
     Within  = 0.1881                                         min =          1
     Between = 0.1983                                         avg =       14.2
     Overall = 0.2060                                         max =         20

                                                F(7, 1846)        =      61.10
corr(u_i, Xb) = -0.1428                         Prob > F          =     0.0000

------------------------------------------------------------------------------
    lrhom_un | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
      fraser |  -.1403576   .0239387    -5.86   0.000    -.1873074   -.0934077
  infantmort |  -.0054254   .0019608    -2.77   0.006    -.0092711   -.0015797
         edu |  -1.914603   .2490363    -7.69   0.000    -2.403025    -1.42618
       unemp |   .0064441   .0027414     2.35   0.019     .0010675    .0118207
    popdense |   -.000318   .0000861    -3.69   0.000     -.000487   -.0001491
    perurban |  -.0159627   .0038673    -4.13   0.000    -.0235473    -.008378
    sexratio |  -.0143586   .0020478    -7.01   0.000    -.0183747   -.0103424
       _cons |   6.067504   .3360613    18.05   0.000     5.408404    6.726604
-------------+----------------------------------------------------------------
     sigma_u |  1.1081936
     sigma_e |  .28668639
         rho |  .93727375   (fraction of variance due to u_i)
------------------------------------------------------------------------------
F test that all u_i=0: F(139, 1846) = 195.18                 Prob > F = 0.0000

. tab nation if e(sample)==1

                           Country Name |      Freq.     Percent        Cum.
----------------------------------------+-----------------------------------
                                Albania |         20        1.00        1.00
                                Algeria |         14        0.70        1.71
                                 Angola |          4        0.20        1.91
                              Argentina |         19        0.95        2.86
                                Armenia |         16        0.80        3.66
                              Australia |         20        1.00        4.67
                                Austria |         20        1.00        5.67
                             Azerbaijan |         12        0.60        6.27
                                Bahamas |         20        1.00        7.28
                                Bahrain |         15        0.75        8.03
                             Bangladesh |         19        0.95        8.98
                               Barbados |         20        1.00        9.98
                                Belarus |          4        0.20       10.19
                                Belgium |          3        0.15       10.34
                                 Belize |         20        1.00       11.34
                                 Bhutan |          6        0.30       11.64
       Bolivia (Plurinational State of) |          5        0.25       11.89
                 Bosnia and Herzegovina |         13        0.65       12.54
                               Botswana |         10        0.50       13.05
                                 Brazil |         20        1.00       14.05
                      Brunei Darussalam |          4        0.20       14.25
                               Bulgaria |         20        1.00       15.25
                                Burundi |          5        0.25       15.50
                             Cabo Verde |          7        0.35       15.86
                               Cambodia |          2        0.10       15.96
                               Cameroon |         12        0.60       16.56
                                 Canada |         20        1.00       17.56
                                  Chile |         16        0.80       18.36
                                  China |         18        0.90       19.27
                               Colombia |         20        1.00       20.27
                             Costa Rica |         20        1.00       21.27
                                Croatia |         20        1.00       22.28
                                 Cyprus |         19        0.95       23.23
                                Czechia |         19        0.95       24.18
                                Denmark |         13        0.65       24.84
                     Dominican Republic |         19        0.95       25.79
                                Ecuador |         16        0.80       26.59
                                  Egypt |         14        0.70       27.30
                            El Salvador |         20        1.00       28.30
                                Estonia |         16        0.80       29.10
                               Eswatini |          8        0.40       29.50
                               Ethiopia |          1        0.05       29.55
                                   Fiji |         12        0.60       30.16
                                Finland |         20        1.00       31.16
                                 France |         20        1.00       32.16
                                Georgia |         12        0.60       32.76
                                Germany |         20        1.00       33.77
                                  Ghana |         19        0.95       34.72
                                 Greece |         18        0.90       35.62
                              Guatemala |         18        0.90       36.53
                          Guinea-Bissau |          2        0.10       36.63
                                 Guyana |         20        1.00       37.63
                                  Haiti |         11        0.55       38.18
                               Honduras |         20        1.00       39.19
                                Hungary |         20        1.00       40.19
                                Iceland |         16        0.80       40.99
                                  India |         20        1.00       42.00
                              Indonesia |          3        0.15       42.15
             Iran (Islamic Republic of) |          3        0.15       42.30
                                Ireland |         20        1.00       43.30
                                 Israel |         20        1.00       44.31
                                  Italy |         18        0.90       45.21
                                Jamaica |         20        1.00       46.21
                                  Japan |         20        1.00       47.22
                                 Jordan |         13        0.65       47.87
                             Kazakhstan |          9        0.45       48.32
                                  Kenya |         15        0.75       49.07
                                 Kuwait |         15        0.75       49.82
                                 Latvia |         11        0.55       50.38
                                Lebanon |         10        0.50       50.88
                                Lesotho |          2        0.10       50.98
                              Lithuania |         19        0.95       51.93
                             Luxembourg |         19        0.95       52.89
                                 Malawi |         13        0.65       53.54
                               Malaysia |         20        1.00       54.54
                                  Malta |         18        0.90       55.44
                             Mauritania |          2        0.10       55.54
                              Mauritius |         12        0.60       56.15
                                 Mexico |         20        1.00       57.15
                               Mongolia |         16        0.80       57.95
                             Montenegro |         13        0.65       58.61
                                Morocco |         20        1.00       59.61
                             Mozambique |          9        0.45       60.06
                                Myanmar |         20        1.00       61.06
                                Namibia |         11        0.55       61.62
                                  Nepal |         20        1.00       62.62
                            Netherlands |         20        1.00       63.62
                            New Zealand |         20        1.00       64.63
                              Nicaragua |         20        1.00       65.63
                                  Niger |          2        0.10       65.73
                                Nigeria |          2        0.10       65.83
                        North Macedonia |         16        0.80       66.63
                                 Norway |         19        0.95       67.59
                                   Oman |         18        0.90       68.49
                               Pakistan |         20        1.00       69.49
                                 Panama |         20        1.00       70.50
                       Papua New Guinea |         10        0.50       71.00
                               Paraguay |         20        1.00       72.00
                                   Peru |          9        0.45       72.45
                            Philippines |         13        0.65       73.11
                                 Poland |         15        0.75       73.86
                               Portugal |         14        0.70       74.56
                                  Qatar |         10        0.50       75.06
                      Republic of Korea |         20        1.00       76.07
                    Republic of Moldova |         15        0.75       76.82
                                Romania |         20        1.00       77.82
                     Russian Federation |         20        1.00       78.83
                                 Rwanda |         12        0.60       79.43
                           Saudi Arabia |          2        0.10       79.53
                                 Serbia |         15        0.75       80.28
                             Seychelles |          6        0.30       80.58
                           Sierra Leone |         10        0.50       81.08
                              Singapore |         19        0.95       82.04
                               Slovakia |         20        1.00       83.04
                               Slovenia |         20        1.00       84.04
                           South Africa |         20        1.00       85.05
                                  Spain |         20        1.00       86.05
                              Sri Lanka |         14        0.70       86.75
                               Suriname |          7        0.35       87.10
                                 Sweden |         20        1.00       88.11
                            Switzerland |         14        0.70       88.81
                   Syrian Arab Republic |         11        0.55       89.36
                             Tajikistan |          2        0.10       89.46
                               Thailand |         12        0.60       90.07
                            Timor-Leste |          2        0.10       90.17
                    Trinidad and Tobago |         20        1.00       91.17
                                Tunisia |          9        0.45       91.62
                                 Turkey |          8        0.40       92.02
                               TÃ¼rkiye |          6        0.30       92.32
                                 Uganda |         12        0.60       92.93
                                Ukraine |         16        0.80       93.73
                   United Arab Emirates |          7        0.35       94.08
United Kingdom of Great Britain and N.. |         20        1.00       95.08
            United Republic of Tanzania |         11        0.55       95.63
               United States of America |         17        0.85       96.49
                                Uruguay |         20        1.00       97.49
     Venezuela (Bolivarian Republic of) |         18        0.90       98.39
                               Viet Nam |          9        0.45       98.85
                                  Yemen |          4        0.20       99.05
                                 Zambia |          9        0.45       99.50
                               Zimbabwe |         10        0.50      100.00
----------------------------------------+-----------------------------------
                                  Total |      1,993      100.00

. gen sample=1 if e(sample)==1 
(20,675 missing values generated)

. /* Nations to drop (n<5)
> Angola
> Belarus
> Belgium
> Brunei Darussalam
> Cambodia
> Ethiopia
> Guinea-Bissau
> Indonesia
> Iran (Islamic Republic of)
> Lesotho
> Mauritania
> Niger
> Nigeria
> Saudi Arabia
> Tajikistan
> Timor-Leste
> Yemen*/ 
. replace sample=. if nation=="Angola"
(4 real changes made, 4 to missing)

. replace sample=. if nation=="Belarus"
(4 real changes made, 4 to missing)

. replace sample=. if nation=="Belgium"
(3 real changes made, 3 to missing)

. replace sample=. if nation=="Brunei Darussalam"
(4 real changes made, 4 to missing)

. replace sample=. if nation=="Cambodia"
(2 real changes made, 2 to missing)

. replace sample=. if nation=="Ethiopia"
(1 real change made, 1 to missing)

. replace sample=. if nation=="Guinea-Bissau"
(2 real changes made, 2 to missing)

. replace sample=. if nation=="Indonesia"
(3 real changes made, 3 to missing)

. replace sample=. if nation=="Iran (Islamic Republic of)"
(3 real changes made, 3 to missing)

. replace sample=. if nation=="Lesotho"
(2 real changes made, 2 to missing)

. replace sample=. if nation=="Mauritania"
(2 real changes made, 2 to missing)

. replace sample=. if nation=="Niger"
(2 real changes made, 2 to missing)

. replace sample=. if nation=="Nigeria"
(2 real changes made, 2 to missing)

. replace sample=. if nation=="Saudi Arabia"
(2 real changes made, 2 to missing)

. replace sample=. if nation=="Tajikistan"
(2 real changes made, 2 to missing)

. replace sample=. if nation=="Timor-Leste"
(2 real changes made, 2 to missing)

. replace sample=. if nation=="Yemen"
(4 real changes made, 4 to missing)

. 
. tab nation if rhom_un==0

                           Country Name |      Freq.     Percent        Cum.
----------------------------------------+-----------------------------------
                         American Samoa |          2        1.48        1.48
                                Andorra |          7        5.19        6.67
                               Anguilla |         10        7.41       14.07
                                  Aruba |          1        0.74       14.81
                                Bahrain |          1        0.74       15.56
                                Bermuda |          3        2.22       17.78
                 British Virgin Islands |          4        2.96       20.74
                         Cayman Islands |          2        1.48       22.22
                              Gibraltar |          1        0.74       22.96
                               Holy See |          5        3.70       26.67
                                Iceland |          5        3.70       30.37
                            Isle of Man |          1        0.74       31.11
                               Kiribati |          8        5.93       37.04
                          Liechtenstein |         16       11.85       48.89
                             Luxembourg |          1        0.74       49.63
                                  Malta |          1        0.74       50.37
                                 Monaco |          2        1.48       51.85
                             Montserrat |         13        9.63       61.48
                                  Palau |          2        1.48       62.96
                           Saint Helena |         15       11.11       74.07
              Saint Pierre and Miquelon |          2        1.48       75.56
                             San Marino |         16       11.85       87.41
               Turks and Caicos Islands |          8        5.93       93.33
                                 Tuvalu |          9        6.67      100.00
----------------------------------------+-----------------------------------
                                  Total |        135      100.00

. replace sample=. if rhom_un==0
(0 real changes made)

. 
. tab nation if sample==1

                           Country Name |      Freq.     Percent        Cum.
----------------------------------------+-----------------------------------
                                Albania |         20        1.03        1.03
                                Algeria |         14        0.72        1.74
                              Argentina |         19        0.97        2.72
                                Armenia |         16        0.82        3.54
                              Australia |         20        1.03        4.57
                                Austria |         20        1.03        5.59
                             Azerbaijan |         12        0.62        6.21
                                Bahamas |         20        1.03        7.23
                                Bahrain |         15        0.77        8.00
                             Bangladesh |         19        0.97        8.98
                               Barbados |         20        1.03       10.01
                                 Belize |         20        1.03       11.03
                                 Bhutan |          6        0.31       11.34
       Bolivia (Plurinational State of) |          5        0.26       11.60
                 Bosnia and Herzegovina |         13        0.67       12.26
                               Botswana |         10        0.51       12.78
                                 Brazil |         20        1.03       13.80
                               Bulgaria |         20        1.03       14.83
                                Burundi |          5        0.26       15.08
                             Cabo Verde |          7        0.36       15.44
                               Cameroon |         12        0.62       16.06
                                 Canada |         20        1.03       17.09
                                  Chile |         16        0.82       17.91
                                  China |         18        0.92       18.83
                               Colombia |         20        1.03       19.86
                             Costa Rica |         20        1.03       20.88
                                Croatia |         20        1.03       21.91
                                 Cyprus |         19        0.97       22.88
                                Czechia |         19        0.97       23.86
                                Denmark |         13        0.67       24.53
                     Dominican Republic |         19        0.97       25.50
                                Ecuador |         16        0.82       26.32
                                  Egypt |         14        0.72       27.04
                            El Salvador |         20        1.03       28.07
                                Estonia |         16        0.82       28.89
                               Eswatini |          8        0.41       29.30
                                   Fiji |         12        0.62       29.91
                                Finland |         20        1.03       30.94
                                 France |         20        1.03       31.97
                                Georgia |         12        0.62       32.58
                                Germany |         20        1.03       33.61
                                  Ghana |         19        0.97       34.58
                                 Greece |         18        0.92       35.51
                              Guatemala |         18        0.92       36.43
                                 Guyana |         20        1.03       37.46
                                  Haiti |         11        0.56       38.02
                               Honduras |         20        1.03       39.05
                                Hungary |         20        1.03       40.07
                                Iceland |         16        0.82       40.89
                                  India |         20        1.03       41.92
                                Ireland |         20        1.03       42.95
                                 Israel |         20        1.03       43.97
                                  Italy |         18        0.92       44.89
                                Jamaica |         20        1.03       45.92
                                  Japan |         20        1.03       46.95
                                 Jordan |         13        0.67       47.61
                             Kazakhstan |          9        0.46       48.08
                                  Kenya |         15        0.77       48.85
                                 Kuwait |         15        0.77       49.62
                                 Latvia |         11        0.56       50.18
                                Lebanon |         10        0.51       50.69
                              Lithuania |         19        0.97       51.67
                             Luxembourg |         19        0.97       52.64
                                 Malawi |         13        0.67       53.31
                               Malaysia |         20        1.03       54.34
                                  Malta |         18        0.92       55.26
                              Mauritius |         12        0.62       55.87
                                 Mexico |         20        1.03       56.90
                               Mongolia |         16        0.82       57.72
                             Montenegro |         13        0.67       58.39
                                Morocco |         20        1.03       59.42
                             Mozambique |          9        0.46       59.88
                                Myanmar |         20        1.03       60.90
                                Namibia |         11        0.56       61.47
                                  Nepal |         20        1.03       62.49
                            Netherlands |         20        1.03       63.52
                            New Zealand |         20        1.03       64.55
                              Nicaragua |         20        1.03       65.57
                        North Macedonia |         16        0.82       66.39
                                 Norway |         19        0.97       67.37
                                   Oman |         18        0.92       68.29
                               Pakistan |         20        1.03       69.32
                                 Panama |         20        1.03       70.34
                       Papua New Guinea |         10        0.51       70.86
                               Paraguay |         20        1.03       71.88
                                   Peru |          9        0.46       72.34
                            Philippines |         13        0.67       73.01
                                 Poland |         15        0.77       73.78
                               Portugal |         14        0.72       74.50
                                  Qatar |         10        0.51       75.01
                      Republic of Korea |         20        1.03       76.04
                    Republic of Moldova |         15        0.77       76.81
                                Romania |         20        1.03       77.83
                     Russian Federation |         20        1.03       78.86
                                 Rwanda |         12        0.62       79.48
                                 Serbia |         15        0.77       80.25
                             Seychelles |          6        0.31       80.55
                           Sierra Leone |         10        0.51       81.07
                              Singapore |         19        0.97       82.04
                               Slovakia |         20        1.03       83.07
                               Slovenia |         20        1.03       84.09
                           South Africa |         20        1.03       85.12
                                  Spain |         20        1.03       86.15
                              Sri Lanka |         14        0.72       86.87
                               Suriname |          7        0.36       87.22
                                 Sweden |         20        1.03       88.25
                            Switzerland |         14        0.72       88.97
                   Syrian Arab Republic |         11        0.56       89.53
                               Thailand |         12        0.62       90.15
                    Trinidad and Tobago |         20        1.03       91.17
                                Tunisia |          9        0.46       91.64
                                 Turkey |          8        0.41       92.05
                               TÃ¼rkiye |          6        0.31       92.36
                                 Uganda |         12        0.62       92.97
                                Ukraine |         16        0.82       93.79
                   United Arab Emirates |          7        0.36       94.15
United Kingdom of Great Britain and N.. |         20        1.03       95.18
            United Republic of Tanzania |         11        0.56       95.74
               United States of America |         17        0.87       96.61
                                Uruguay |         20        1.03       97.64
     Venezuela (Bolivarian Republic of) |         18        0.92       98.56
                               Viet Nam |          9        0.46       99.03
                                 Zambia |          9        0.46       99.49
                               Zimbabwe |         10        0.51      100.00
----------------------------------------+-----------------------------------
                                  Total |      1,949      100.00

. drop if sample!=1
(20,719 observations deleted)

. 
. //      #2
. //      normal 
. * qladder rhom_un 
. label var lrhom_un "Ln Homicide Victimization Rates" 

. note lrhom_un: `note'. 

. 
. //      #3
. //      station 
. xtunitroot fisher rhom_un, dfuller lags(0) 

Fisher-type unit-root test for rhom_un
Based on augmented Dickey–Fuller tests
--------------------------------------
H0: All panels contain unit roots           Number of panels       =    123
Ha: At least one panel is stationary        Avg. number of periods =  15.85

AR parameter: Panel-specific                Asymptotics: T -> Infinity
Panel means:  Included
Time trend:   Not included
Drift term:   Not included                  ADF regressions: 0 lags
------------------------------------------------------------------------------
                                  Statistic      p-value
------------------------------------------------------------------------------
 Inverse chi-squared(246)  P       462.6334       0.0000
 Inverse normal            Z        -4.8115       0.0000
 Inverse logit t(619)      L*       -6.2960       0.0000
 Modified inv. chi-squared Pm        9.7666       0.0000
------------------------------------------------------------------------------
 P statistic requires number of panels to be finite.
 Other statistics are suitable for finite or infinite number of panels.
------------------------------------------------------------------------------

. 
. foreach var in `iv' `cont'  {
  2.         xtunitroot fisher `var', dfuller lags(0) 
  3.         }

Fisher-type unit-root test for fraser
Based on augmented Dickey–Fuller tests
--------------------------------------
H0: All panels contain unit roots           Number of panels       =    123
Ha: At least one panel is stationary        Avg. number of periods =  15.85

AR parameter: Panel-specific                Asymptotics: T -> Infinity
Panel means:  Included
Time trend:   Not included
Drift term:   Not included                  ADF regressions: 0 lags
------------------------------------------------------------------------------
                                  Statistic      p-value
------------------------------------------------------------------------------
 Inverse chi-squared(246)  P       494.2395       0.0000
 Inverse normal            Z        -5.8656       0.0000
 Inverse logit t(619)      L*       -7.4882       0.0000
 Modified inv. chi-squared Pm       11.1915       0.0000
------------------------------------------------------------------------------
 P statistic requires number of panels to be finite.
 Other statistics are suitable for finite or infinite number of panels.
------------------------------------------------------------------------------

Fisher-type unit-root test for infantmort
Based on augmented Dickey–Fuller tests
-----------------------------------------
H0: All panels contain unit roots           Number of panels       =    123
Ha: At least one panel is stationary        Avg. number of periods =  15.85

AR parameter: Panel-specific                Asymptotics: T -> Infinity
Panel means:  Included
Time trend:   Not included
Drift term:   Not included                  ADF regressions: 0 lags
------------------------------------------------------------------------------
                                  Statistic      p-value
------------------------------------------------------------------------------
 Inverse chi-squared(246)  P      3187.1254       0.0000
 Inverse normal            Z       -34.3333       0.0000
 Inverse logit t(594)      L*      -75.5751       0.0000
 Modified inv. chi-squared Pm      132.5962       0.0000
------------------------------------------------------------------------------
 P statistic requires number of panels to be finite.
 Other statistics are suitable for finite or infinite number of panels.
------------------------------------------------------------------------------

Fisher-type unit-root test for edu
Based on augmented Dickey–Fuller tests
--------------------------------------
H0: All panels contain unit roots           Number of panels       =    123
Ha: At least one panel is stationary        Avg. number of periods =  15.85

AR parameter: Panel-specific                Asymptotics: T -> Infinity
Panel means:  Included
Time trend:   Not included
Drift term:   Not included                  ADF regressions: 0 lags
------------------------------------------------------------------------------
                                  Statistic      p-value
------------------------------------------------------------------------------
 Inverse chi-squared(246)  P       509.8210       0.0000
 Inverse normal            Z        -0.5203       0.3014
 Inverse logit t(614)      L*       -4.0847       0.0000
 Modified inv. chi-squared Pm       11.8940       0.0000
------------------------------------------------------------------------------
 P statistic requires number of panels to be finite.
 Other statistics are suitable for finite or infinite number of panels.
------------------------------------------------------------------------------

Fisher-type unit-root test for unemp
Based on augmented Dickey–Fuller tests
--------------------------------------
H0: All panels contain unit roots           Number of panels       =    123
Ha: At least one panel is stationary        Avg. number of periods =  15.85

AR parameter: Panel-specific                Asymptotics: T -> Infinity
Panel means:  Included
Time trend:   Not included
Drift term:   Not included                  ADF regressions: 0 lags
------------------------------------------------------------------------------
                                  Statistic      p-value
------------------------------------------------------------------------------
 Inverse chi-squared(246)  P       449.5591       0.0000
 Inverse normal            Z        -1.5808       0.0570
 Inverse logit t(614)      L*       -3.7210       0.0001
 Modified inv. chi-squared Pm        9.1772       0.0000
------------------------------------------------------------------------------
 P statistic requires number of panels to be finite.
 Other statistics are suitable for finite or infinite number of panels.
------------------------------------------------------------------------------

Fisher-type unit-root test for popdense
Based on augmented Dickey–Fuller tests
---------------------------------------
H0: All panels contain unit roots           Number of panels       =    123
Ha: At least one panel is stationary        Avg. number of periods =  15.85

AR parameter: Panel-specific                Asymptotics: T -> Infinity
Panel means:  Included
Time trend:   Not included
Drift term:   Not included                  ADF regressions: 0 lags
------------------------------------------------------------------------------
                                  Statistic      p-value
------------------------------------------------------------------------------
 Inverse chi-squared(246)  P      1390.4950       0.0000
 Inverse normal            Z       -13.0801       0.0000
 Inverse logit t(424)      L*      -32.5864       0.0000
 Modified inv. chi-squared Pm       51.5978       0.0000
------------------------------------------------------------------------------
 P statistic requires number of panels to be finite.
 Other statistics are suitable for finite or infinite number of panels.
------------------------------------------------------------------------------

Fisher-type unit-root test for perurban
Based on augmented Dickey–Fuller tests
---------------------------------------
H0: All panels contain unit roots           Number of panels       =    123
Ha: At least one panel is stationary        Avg. number of periods =  15.85

AR parameter: Panel-specific                Asymptotics: T -> Infinity
Panel means:  Included
Time trend:   Not included
Drift term:   Not included                  ADF regressions: 0 lags
------------------------------------------------------------------------------
                                  Statistic      p-value
------------------------------------------------------------------------------
 Inverse chi-squared(246)  P      1979.6394       0.0000
 Inverse normal            Z       -19.4985       0.0000
 Inverse logit t(419)      L*      -50.3775       0.0000
 Modified inv. chi-squared Pm       78.1585       0.0000
------------------------------------------------------------------------------
 P statistic requires number of panels to be finite.
 Other statistics are suitable for finite or infinite number of panels.
------------------------------------------------------------------------------

Fisher-type unit-root test for sexratio
Based on augmented Dickey–Fuller tests
---------------------------------------
H0: All panels contain unit roots           Number of panels       =    123
Ha: At least one panel is stationary        Avg. number of periods =  15.85

AR parameter: Panel-specific                Asymptotics: T -> Infinity
Panel means:  Included
Time trend:   Not included
Drift term:   Not included                  ADF regressions: 0 lags
------------------------------------------------------------------------------
                                  Statistic      p-value
------------------------------------------------------------------------------
 Inverse chi-squared(246)  P      1223.7671       0.0000
 Inverse normal            Z        -5.6994       0.0000
 Inverse logit t(544)      L*      -20.1978       0.0000
 Modified inv. chi-squared Pm       44.0811       0.0000
------------------------------------------------------------------------------
 P statistic requires number of panels to be finite.
 Other statistics are suitable for finite or infinite number of panels.
------------------------------------------------------------------------------

.         
. //      #4
. //  Autocorrelation 
. xtserial lrhom_un `iv' `cont'

Wooldridge test for autocorrelation in panel data
H0: no first order autocorrelation
    F(  1,     122) =     13.549
           Prob > F =      0.0003

. xtserial lrhom_un `iv' `cont2'

Wooldridge test for autocorrelation in panel data
H0: no first order autocorrelation
    F(  1,      75) =     10.426
           Prob > F =      0.0018

. 
. //      #5
. //      Cross-Sectional Dependence 
. xtreg rhom_un `iv' `cont' , fe

Fixed-effects (within) regression               Number of obs     =      1,949
Group variable: CID                             Number of groups  =        123

R-squared:                                      Obs per group:
     Within  = 0.0370                                         min =          5
     Between = 0.0095                                         avg =       15.8
     Overall = 0.0121                                         max =         20

                                                F(7, 1819)        =       9.98
corr(u_i, Xb) = -0.1734                         Prob > F          =     0.0000

------------------------------------------------------------------------------
     rhom_un | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
      fraser |  -2.064537   .3121177    -6.61   0.000    -2.676684    -1.45239
  infantmort |   .0095938   .0255219     0.38   0.707    -.0404616    .0596492
         edu |   5.219989    3.23967     1.61   0.107    -1.133875    11.57385
       unemp |   .0532618   .0356702     1.49   0.136     -.016697    .1232207
    popdense |  -.0000231   .0011186    -0.02   0.984    -.0022169    .0021707
    perurban |  -.1290028   .0502382    -2.57   0.010    -.2275334   -.0304722
    sexratio |  -.0244582   .0265905    -0.92   0.358    -.0766094    .0276929
       _cons |   29.18152   4.370957     6.68   0.000      20.6089    37.75415
-------------+----------------------------------------------------------------
     sigma_u |  11.655874
     sigma_e |  3.7223242
         rho |   .9074529   (fraction of variance due to u_i)
------------------------------------------------------------------------------
F test that all u_i=0: F(122, 1819) = 149.50                 Prob > F = 0.0000

. * xtcsd, pesaran abs
. xtreg lrhom_un `iv' `cont2' , fe

Fixed-effects (within) regression               Number of obs     =      1,310
Group variable: CID                             Number of groups  =        119

R-squared:                                      Obs per group:
     Within  = 0.2682                                         min =          1
     Between = 0.2137                                         avg =       11.0
     Overall = 0.2535                                         max =         20

                                                F(8, 1183)        =      54.20
corr(u_i, Xb) = 0.0652                          Prob > F          =     0.0000

------------------------------------------------------------------------------
    lrhom_un | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
      fraser |   -.245574   .0307218    -7.99   0.000    -.3058493   -.1852988
  infantmort |  -.0007015   .0034025    -0.21   0.837    -.0073772    .0059741
        gini |  -.0088469   .0035056    -2.52   0.012    -.0157247   -.0019691
         edu |  -2.852439   .2988853    -9.54   0.000    -3.438843   -2.266034
       unemp |   .0062948   .0030331     2.08   0.038      .000344    .0122457
    popdense |  -.0000247   .0001864    -0.13   0.895    -.0003903    .0003409
    perurban |  -.0053944   .0044809    -1.20   0.229    -.0141857    .0033969
    sexratio |  -.0175298   .0046161    -3.80   0.000    -.0265865   -.0084731
       _cons |   7.367005   .5662695    13.01   0.000     6.256001     8.47801
-------------+----------------------------------------------------------------
     sigma_u |  1.0905527
     sigma_e |  .26649594
         rho |   .9436494   (fraction of variance due to u_i)
------------------------------------------------------------------------------
F test that all u_i=0: F(118, 1183) = 99.28                  Prob > F = 0.0000

. * xtcsd, pesaran abs
. 
. /* Neither had enough obs */ 
. 
. //      #6
. //      Homoscedastic 
. xtreg lrhom_un `iv' `cont' , fe

Fixed-effects (within) regression               Number of obs     =      1,949
Group variable: CID                             Number of groups  =        123

R-squared:                                      Obs per group:
     Within  = 0.1913                                         min =          5
     Between = 0.2204                                         avg =       15.8
     Overall = 0.2113                                         max =         20

                                                F(7, 1819)        =      61.46
corr(u_i, Xb) = -0.1324                         Prob > F          =     0.0000

------------------------------------------------------------------------------
    lrhom_un | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
      fraser |  -.1410917   .0240031    -5.88   0.000    -.1881682   -.0940152
  infantmort |  -.0055433   .0019627    -2.82   0.005    -.0093927   -.0016938
         edu |  -1.930045   .2491434    -7.75   0.000    -2.418682   -1.441407
       unemp |     .00663   .0027432     2.42   0.016     .0012499    .0120102
    popdense |  -.0003164    .000086    -3.68   0.000    -.0004851   -.0001476
    perurban |  -.0158748   .0038635    -4.11   0.000    -.0234522   -.0082974
    sexratio |  -.0143736   .0020449    -7.03   0.000    -.0183842    -.010363
       _cons |   6.094406   .3361439    18.13   0.000     5.435137    6.753674
-------------+----------------------------------------------------------------
     sigma_u |  1.0898811
     sigma_e |  .28626146
         rho |  .93546504   (fraction of variance due to u_i)
------------------------------------------------------------------------------
F test that all u_i=0: F(122, 1819) = 216.17                 Prob > F = 0.0000

. xttest3 

Modified Wald test for groupwise heteroskedasticity
in fixed effect regression model

H0: sigma(i)^2 = sigma^2 for all i

chi2 (123)  =      60867.26
Prob > chi2 =          0.0000


. 
. //      #7
. //      Final model 
. xtreg lrhom_un `iv' `cont', fe vce(robust) 

Fixed-effects (within) regression               Number of obs     =      1,949
Group variable: CID                             Number of groups  =        123

R-squared:                                      Obs per group:
     Within  = 0.1913                                         min =          5
     Between = 0.2204                                         avg =       15.8
     Overall = 0.2113                                         max =         20

                                                F(7, 122)         =      27.74
corr(u_i, Xb) = -0.1324                         Prob > F          =     0.0000

                                  (Std. err. adjusted for 123 clusters in CID)
------------------------------------------------------------------------------
             |               Robust
    lrhom_un | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
      fraser |  -.1410917   .0640951    -2.20   0.030    -.2679745    -.014209
  infantmort |  -.0055433   .0042829    -1.29   0.198    -.0140217    .0029351
         edu |  -1.930045   .5667989    -3.41   0.001     -3.05208   -.8080095
       unemp |     .00663    .005326     1.24   0.216    -.0039133    .0171734
    popdense |  -.0003164   .0000724    -4.37   0.000    -.0004597    -.000173
    perurban |  -.0158748   .0107785    -1.47   0.143    -.0372119    .0054624
    sexratio |  -.0143736   .0042746    -3.36   0.001    -.0228355   -.0059116
       _cons |   6.094406   .8099195     7.52   0.000     4.491089    7.697722
-------------+----------------------------------------------------------------
     sigma_u |  1.0898811
     sigma_e |  .28626146
         rho |  .93546504   (fraction of variance due to u_i)
------------------------------------------------------------------------------

. outreg2 using `file', replace `opt' 
/Users/meghrogers/Library/Application Support/Stata/ado/plus/o/outreg2.ado
MAR02-SampDiag-UNODC.xml
dir : seeout

. 
. //      #8
. //      save and close 
. note:  Completed sample and pre-model diagnostics | `note'. 

. notes

_dta:
  1.  Cleaned WHO homicide data for overall, age and gender | merged data
      together | |meg | 03-23-2023 | CT01-DataMerge-V02.
  2.  30JUN2022
  3.  Got data out of .csv into .dta, merged data, and generated variables | \
      06-28-2022 \ SP01-CleaningData.
  4.  Completed sample and pre-model diagnostics | | 05-05-25 |
      MAR02-SampDiag-UNODC.

ryoung:
  1.  (pop1519*1000)+(pop2024*1000)/pop *100

rmyoung:
  1.  (mpop1519*1000)+(mpop2024*1000)+(mpop2529*1000)/popmale*100 | \ 06-28-2022
      \ SP01-CleaningData.

edu:
  1.  (eys_index+mys_index)/2 | \ 06-28-2022 \ SP01-CleaningData.

unemp:
  1.  Nation Estimates then missing filled with ILO estimates corr 1 or .9457 |
      \ 06-28-2022 \ SP01-CleaningData.

sexratio:
  1.  popmale/popfemale*100 | \ 06-28-2022 \ SP01-CleaningData.

eys_index:
  1.  (eys-0)/(18+0) | \ 06-28-2022 \ SP01-CleaningData

mys_index:
  1.  (mys-0)/(15+0) | \ 06-28-2022 \ SP01-CleaningData

lrhom_un:
  1.  | 05-05-25 | MAR02-SampDiag-UNODC.

. save `file'.dta, replace 
(file MAR02-SampDiag-UNODC.dta not found)
file MAR02-SampDiag-UNODC.dta saved

. log close 
      name:  <unnamed>
       log:  /Volumes/rdss_meghrogers/Current Research/Markets-Pridemore/Work/MA
> R02-SampDiag-UNODC.log
  log type:  text
 closed on:   5 May 2025, 14:04:57
--------------------------------------------------------------------------------
